<%@page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
</head>
<body>
	<h3>Welcome to Spring MVC's Demo</h3>
	<form target="emp" action="create">
		<input name="age" />
		<input name="email" />
		<input name="name" />
		<input type="submit" value="submit" />
	</form>
	<table border="1" cellpadding="5">
		<thead>
			<tr>
				<th>Name</th>
				<th>Age</th>
				<th>Email</th>
				<th>Action</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${employees}" var="employee">
				<tr id="${employee.id}">
					<td><input value="${employee.name}" /></td>
					<td><input value="${employee.age}" /></td>
					<td><input value="${employee.email}" /></td>
					<td><input type="button" value="Update"
						onclick="updateEmployee(${employee.id});" /><input type="button" value="Delete"
						onclick="deleteEmployee(${employee.id});" /></td>
				</tr>
				<tr id="${employee.id}">
					<td><input value="${employee.name}" /></td>
					<td><input value="${employee.age}" /></td>
					<td><input value="${employee.email}" /></td>
					<td><input type="button" value="Add"
						onclick="updateEmployee(${employee.id});" /></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<script>
		function updateEmployee(id) {
			
			console.log(id);
		}
		function deleteEmployee(id) {
			console.log(id);
		}
	</script>
</body>
</html>